function getComments_SAIC(post_id,num_comments,num_get_comments,order_comments){var status=jQuery("#saic-comment-status-"+post_id),$container_comments=jQuery("ul#saic-container-comment-"+post_id);return num_comments>0&&jQuery.ajax({type:"POST",dataType:"html",url:WDS_RSVP.ajaxurl,data:{action:"get_comments",post_id:post_id,get:num_get_comments,order:order_comments,nonce:WDS_RSVP.nonce},beforeSend:function(){status.addClass("saic-loading").html('').show()},success:function(data){status.removeClass("saic-loading").html("").hide(),$container_comments.html(data),$container_comments.show(),jPages_SAIC(post_id,WDS_RSVP.jPagesNum)},error:function(jqXHR,textStatus,errorThrown){clog("ajax error"),clog("jqXHR"),clog(jqXHR),clog("errorThrown"),clog(errorThrown)},complete:function(jqXHR,textStatus){}}),!1}function insertComment_SAIC(post_id,num_comments){var link_show_comments=jQuery("#saic-link-"+post_id),comment_form=jQuery("#commentform-"+post_id),status=jQuery("#saic-comment-status-"+post_id),formSubmit=jQuery("#saic-wrap-form-"+post_id),form_data=new FormData(comment_form[0]),btnSubmit=jQuery(".saic-wrap-submit");return form_data.append("action","insert_comment"),form_data.append("nonce",WDS_RSVP.nonce),jQuery.ajax({type:"POST",dataType:"html",url:WDS_RSVP.ajaxurl,data:form_data,processData:!1,contentType:!1,beforeSend:function(){btnSubmit.hide(),status.addClass("saic-loading").html('').show()},success:function(data,textStatus){if(status.removeClass("saic-loading").html(""),data.startsWith("error-")){let errorMessage=data.substring(6);status.html('

'+errorMessage+"

"),btnSubmit.show()}else status.html('

'+WDS_RSVP.thanksComment+"

"),link_show_comments.find("span").length&&(num_comments=String(parseInt(num_comments,10)+1),link_show_comments.find("span").html(num_comments)),jQuery("ul#saic-container-comment-"+post_id).prepend(data).show(),jPages_SAIC(post_id,WDS_RSVP.jPagesNum,!0),formSubmit.hide()},error:function(XMLHttpRequest,textStatus,errorThrown){status.removeClass("saic-loading").html('

'+WDS_RSVP.duplicateComment+"

")},complete:function(jqXHR,textStatus){setTimeout((function(){status.removeClass("saic-loading").fadeOut(600)}),2500)}}),!1}function jPages_SAIC(post_id,$numPerPage,$destroy){if("function"==typeof jQuery.fn.jPages){var $idList="saic-container-comment-"+post_id,$holder="div.saic-holder-"+post_id,num_comments;jQuery("#"+$idList+" > li").length>$numPerPage&&($destroy&&jQuery("#"+$idList).children().removeClass("animated jp-hidden"),jQuery($holder).show().jPages({containerID:$idList,previous:WDS_RSVP.textNavPrev,next:WDS_RSVP.textNavNext,perPage:parseInt($numPerPage,10),minHeight:!1,keyBrowse:!0,direction:"forward",animation:"fadeIn"}))}return!1}function getUrlVars_SAIC(url){for(var query,parts=url.substring(url.indexOf("?")+1).split("&"),params={},i=0;i1&&ids.slice(1).closest(".saic-wrapper").remove()})),$('.saic-container-form [name="comment_parent"], .saic-container-form [name="comment_post_ID"]').each((function(index,input){$(input).removeAttr("id")})),"function"==typeof jQuery.fn.textareaCount&&$(".saic-textarea").each((function(){var textCount={maxCharacterSize:WDS_RSVP.textCounterNum,originalStyle:"saic-counter-info",warningStyle:"saic-counter-warn",warningNumber:20,displayFormat:"#left"};$(this).textareaCount(textCount)})),"function"==typeof jQuery.fn.placeholder&&$(".saic-wrap-form input, .saic-wrap-form textarea").placeholder(),"function"==typeof autosize&&autosize($("textarea.saic-textarea")),$(".saic-wrapper").each((function(){rezizeBoxComments_SAIC($(this))})),$(window).resize((function(){$(".saic-wrapper").each((function(){rezizeBoxComments_SAIC($(this))}))})),$("body").on("click","a.saic-link",(function(e){e.preventDefault();var linkVars=getUrlVars_SAIC($(this).attr("href")),post_id=linkVars.post_id,num_comments=linkVars.comments,num_get_comments=linkVars.get,order_comments=linkVars.order;$("#saic-wrap-comment-"+post_id).slideToggle(200);var container_comment=$("#saic-container-comment-"+post_id);return container_comment.length&&0===container_comment.html().length&&getComments_SAIC(post_id,num_comments,num_get_comments,order_comments),!1})),$("a.saic-link").length&&$("a.saic-link.auto-load-true").each((function(){$(this).click()})),$("input, select, textarea").focus((function(){$(this).removeClass("saic-error"),$(this).siblings(".saic-error-info").hide()})),$("#attendance").change((function(){var selectedValue=$(this).val(),guestSelect=$("#guest");"present"===selectedValue?$(".saic-wrap-guest").show():$(".saic-wrap-guest").hide()})),$("body").on("submit",".saic-container-form form",(function(e){e.preventDefault(),$(this).find(":submit").attr("disabled","disabled"),$("input, textarea").removeClass("saic-error");var formID,post_id=$(this).attr("id").replace("commentform-",""),form=$("#commentform-"+post_id),link_show_comments,num_comments=$("#saic-link-"+post_id).attr("href").split("=")[2],form_ok=!0,$content;if(form.find("textarea").val().replace(/\s+/g," ").length<2)return form.find(".saic-textarea").addClass("saic-error"),form.find(".saic-error-info-text").show(),setTimeout((function(){form.find(".saic-error-info-text").fadeOut(500)}),2500),$(this).find(":submit").removeAttr("disabled"),!1;if($(this).find("input#author").length){var $author=$(this).find("input#author"),$authorVal=$author.val().replace(/\s+/g," "),$authorRegEx;" "!=$authorVal&&/^[^<>]{1,50}$/i.test($authorVal)||($author.addClass("saic-error"),form.find(".saic-error-info-name").show(),setTimeout((function(){form.find(".saic-error-info-name").fadeOut(500)}),3e3),form_ok=!1)}if($(this).find("input#email").length){var $emailRegEx=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i,$email=$(this).find("input#email"),$emailVal=$email.val().replace(/\s+/g,"");$email.val($emailVal),$emailRegEx.test($emailVal)||($email.addClass("saic-error"),form.find(".saic-error-info-email").show(),setTimeout((function(){form.find(".saic-error-info-email").fadeOut(500)}),3e3),form_ok=!1)}if($(this).find("select#attendance").length){var $attendance=$(this).find("select#attendance"),$guest=$(this).find("select#guest");if($attendance.length>0){var $attendanceVal=$attendance.val();if(null!==$attendanceVal&&""!==$attendanceVal.trim()){var $attendanceVals=$attendanceVal.replace(/\s+/g," "),$attendanceRegEx;if(/^[^?&%$=\/]{1,30}$/i.test($attendanceVals)||($attendance.addClass("saic-error"),form.find(".saic-error-info-attendance").show(),setTimeout((function(){form.find(".saic-error-info-attendance").fadeOut(500)}),3e3),form_ok=!1),"present"==$attendanceVal){var $guestVal=$guest.val();null!=$guestVal&&""!=$guestVal.trim()||($guest.addClass("saic-error"),form.find(".saic-error-info-guest").show(),setTimeout((function(){form.find(".saic-error-info-guest").fadeOut(500)}),3e3),form_ok=!1)}}else $attendance.addClass("saic-error"),form.find(".saic-error-info-attendance").show(),setTimeout((function(){form.find(".saic-error-info-attendance").fadeOut(500)}),3e3),form_ok=!1}}return form_ok?(!0===form_ok&&insertComment_SAIC(post_id,num_comments),$(this).find(":submit").removeAttr("disabled"),!1):($(this).find(":submit").removeAttr("disabled"),!1)}))}));